package com.dhkj.web.idf.model;

import android.os.Parcel;
import android.os.Parcelable;

import com.google.gson.annotations.SerializedName;

import java.util.List;

public class DishInfo implements Parcelable{

    @SerializedName("location")
    private MatchLocation location;

    @SerializedName("match_information_array")
    private List<MatchInfo> matchInfos;

    @SerializedName("nutrition")
    private Nutrition nutrition;

    @SerializedName("price")
    private DishPrice price;

    private MenuPicture menuPicture;

    private byte[] subImage;

    private List<DishInfo> dishInfos;

    private MatchInfo headMatchInfo;

    public MatchLocation getLocation() {
        return location;
    }

    public void setLocation(MatchLocation location) {
        this.location = location;
    }

    public List<MatchInfo> getMatchInfos() {
        return matchInfos;
    }

    public void setMatchInfos(List<MatchInfo> matchInfos) {
        this.matchInfos = matchInfos;
    }

    public Nutrition getNutrition() {
        return nutrition;
    }

    public void setNutrition(Nutrition nutrition) {
        this.nutrition = nutrition;
    }

    public DishPrice getPrice() {
        return price;
    }

    public void setPrice(DishPrice price) {
        this.price = price;
    }

    public MenuPicture getMenuPicture() {
        return menuPicture;
    }

    public void setMenuPicture(MenuPicture menuPicture) {
        this.menuPicture = menuPicture;
    }

    public byte[] getSubImage() {
        return subImage;
    }

    public void setSubImage(byte[] subImage) {
        this.subImage = subImage;
    }

    public List<DishInfo> getDishInfos() {
        return dishInfos;
    }

    public void setDishInfos(List<DishInfo> dishInfos) {
        this.dishInfos = dishInfos;
    }

    public MatchInfo getHeadMatchInfo() {
        return headMatchInfo;
    }

    public void setHeadMatchInfo(MatchInfo headMatchInfo) {
        this.headMatchInfo = headMatchInfo;
    }

    public DishInfo(Parcel in) {
        this.location = in.readParcelable(MatchLocation.class.getClassLoader());
        this.matchInfos = in.readArrayList(DishInfo.class.getClassLoader());
        this.menuPicture = in.readParcelable(MenuPicture.class.getClassLoader());
        this.headMatchInfo = in.readParcelable(MatchInfo.class.getClassLoader());
        int length = in.readInt();
        if (length != 0) {
            this.subImage = new byte[in.readInt()];
            in.readByteArray(this.subImage);
        }
    }

    public static final Parcelable.Creator<DishInfo> CREATOR = new Parcelable.Creator<DishInfo>() {
        @Override
        public DishInfo createFromParcel(Parcel in) {
            return new DishInfo(in);
        }

        @Override
        public DishInfo[] newArray(int size) {
            return new DishInfo[size];
        }
    };

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel parcel, int i) {
        parcel.writeParcelable(this.location,0);
        parcel.writeList(this.matchInfos);
        parcel.writeParcelable(this.menuPicture,0);
        parcel.writeParcelable(this.headMatchInfo,0);
        if (this.subImage == null) {
            parcel.writeInt(0);
        } else {
            parcel.writeInt(this.subImage.length);
            parcel.writeByteArray(this.subImage);
        }
    }
}
